package easy;

public class Solution_1518 {
    public int numWaterBottles(int numBottles, int numExchange) {
        int count = numBottles;
        while (numBottles >= numExchange) {
            int temp = numBottles / numExchange;
            numBottles = numBottles % numExchange + temp;
            count += temp;
        }
        return count;
    }

    public static void main(String[] args) {
        Solution_1518 model = new Solution_1518();
        System.out.println(model.numWaterBottles(9, 3));
        System.out.println(model.numWaterBottles(15, 4));
        System.out.println(model.numWaterBottles(5, 5));
        System.out.println(model.numWaterBottles(2, 3));
    }
}
